package com.haixee.parkdemo.auth.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;

/**
 * JWT 配置项
 *
 * @author RUIFENG GUO
 * 2020/3/26 15:14
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "web")
public class WebProperties {

    public static String G_ENV;

    private String name;

    private String env = "prod";

    private List<Jwt> jwt = new ArrayList<>();

    private List<WxProperties> wx = new ArrayList<>();

    @PostConstruct
    public void init() {
        G_ENV = env;
    }

    @Data
    public static class Jwt {
        private String alg;

        private String key;

        private Long expire;

        private boolean direct = true;

        private String prikey;

        private String pubkey;

        private String name;
    }

    @Data
    public static class WxProperties {

        private String key;

        private String secret;
    }
}
